package org.loong.crypto.service.core.provider;

import org.loong.crypto.common.exception.CryptoException;
import org.loong.crypto.core.algorithm.SignatureAlgorithm;
import org.loong.crypto.core.params.SignatureParameters;

/**
 * Signer.
 */
public interface Signer extends SignatureProvider {

    /**
     * Initialise the signer for signing.
     * 
     * @param parameters the signature parameters.
     */
    default void init(SignatureParameters parameters) {
        
    }
    
    /**
     * Sign data.
     * 
     * @param algorithm the algorithm
     * @param data the data to sign
     * @return the result signature
     * @throws CryptoException the {@link CryptoException}
     */
    byte[] sign(final SignatureAlgorithm algorithm, final byte[] data) throws CryptoException;
}
